<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>生命周期</title>
    <script type="text/javascript" src="../assets/js/vue-2.3.0.js"></script>
</head>
<body>
    <h1>Vue生命周期</h1>
    <hr>
    <div id="app">
        <p>{{message}}</p>
        <button @click="change">快点本宝宝</button>
    </div>
    <button onclick="app.$destroy()">销毁</button>
</body>
<script type="text/javascript">
    var app = new Vue({
        el:'#app',
        data:{
            message: 'Hello world!'
        },
        methods:{
            change:function(){
                this.message = 'all my friends'
            }
        },
        beforeCreate: function () {
			console.log('1 beforeCreate 初始化之前')
        },
        created: function () {
			console.log('2 created 创建完成')
        },
		beforeMount:function () {
			console.log('3 beforeMount 挂载之前')
        },
        mounted: function () {
			console.log('4 mounted 被创建 ')
        },
        beforeUpdate: function () {
			console.log('5 beforeUpdate 数据更新前')
        },
        updated:function () {
			console.log('6 updated  被更新后')
        },
        beforeDestroy:function () {
			console.log('7 beforeDestroy 销毁之前')
        },
		destroyed:function () {
			console.log('8 destroyed 销毁之后')
        }
    })
</script>
</html>